home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
edit
/
mg2a_src.zip
/
SYS
/
VMS
/
UNIXFNS.MAR
< prev
Wrap
Text File
|
1988-08-23
|
938b
|
39 lines
.title unixfns MG access to Unix library functions
;
; bcopy by Mic Kaczmarczik, July 11, 1986
; everything else by Peter Newton April 24, 1987
;
; UNIX stack-based memory allocation
;
.entry alloca,^m<>
movl 4(ap),r0 ; number of bytes
movl 16(fp),r1 ; return address
moval alloca_reenter,16(fp) ; return to reenter code
ret
alloca_reenter:
addl #3,r0 ; round up byte count to
bicl #3,r0 ; longword boundary
subl r0,sp ; allocate stack space
moval (sp),r0 ; address of allocated block
jmp (r1) ; return to caller
;
; UNIX bcmp function
;
.entry bcmp,^m<r2,r3>
cmpc3 12(ap),@4(ap),@8(ap)
ret
;
; UNIX bcopy function
;
.entry bcopy,^m<r2,r3,r4,r5> ; MOVC3 side-effects r0-r5
subl2 #4,sp ; Step over call frame
movc3 12(ap),@4(ap),@8(ap) ; Copy them bytes
ret ; Bye!
;
; UNIX bzero function
;
.entry bzero,^m<r2,r3,r4,r5>
movc5 #0,(r0),#0,8(ap),@4(ap)
ret
.end